Skip to content

Suppress cppcheck unusedFunction false positives in headers#19890

Open
rascani wants to merge 1 commit into
pytorch:mainfrom
rascani:cppcheck-suppress-header-unusedfunction
Open

Suppress cppcheck unusedFunction false positives in headers#19890
rascani wants to merge 1 commit into
pytorch:mainfrom
rascani:cppcheck-suppress-header-unusedfunction

Conversation

@rascani
Copy link
Copy Markdown
Contributor

@rascani rascani commented May 29, 2026

Summary

cppcheck's unusedFunction is a whole-program check, but lintrunner analyzes files individually. Functions defined in headers are used by the .cpp files that include them, but cppcheck only sees the header in isolation and falsely reports them as never used. Suppress the check for .h/.hpp files while keeping it active for .cpp.

Authored with assistance from Claude.

cppcheck's unusedFunction is a whole-program check, but lintrunner
analyzes files individually. Functions defined in headers are used by
the .cpp files that include them, but cppcheck only sees the header in
isolation and falsely reports them as never used. Suppress the check
for .h/.hpp files while keeping it active for .cpp.

Authored with assistance from Claude.
@rascani rascani requested a review from perheld May 29, 2026 23:53
@pytorch-bot
Copy link
Copy Markdown

pytorch-bot Bot commented May 29, 2026

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/19890

Note: Links to docs will display an error until the docs builds have been completed.

✅ No Failures

As of commit 2b3e4a8 with merge base 0e6b67e (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label May 29, 2026
@github-actions
Copy link
Copy Markdown

This PR needs a release notes: label

If your change should be included in the release notes (i.e. would users of this library care about this change?), please use a label starting with release notes:. This helps us keep track and include your important work in the next release notes.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "release notes: none"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

@rascani rascani requested a review from digantdesai May 29, 2026 23:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant